#pragma once
#include <jthread.h>
#include <dsound.h>
#include "MutexBuffer.h"

namespace ipsound {

class SoundPlay : public JThread
{
public:
	SoundPlay( MutexBuffer* buffer, LPDIRECTSOUNDBUFFER8 playBuf8 );
	void* Thread();
	void SetNotifySamplesNum( const unsigned short& notifySamplesNum );
	~SoundPlay();
private:
	void PutDataInSoundBuffer( const void* data, const size_t& size );
private:
	MutexBuffer* buffer;
	LPDIRECTSOUNDBUFFER8 playBuf8;
	WAVEFORMATEX wfx;
	unsigned long soundBufOffset, soundBufSize;
	unsigned short notifySamplesNum;
};

}